home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / VISCAFE.BIN / SplitterPanel.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-06-19  |  16.3 KB  |  1,069 lines

  1. package symantec.itools.awt;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Component;
  5. import java.awt.Container;
  6. import java.awt.Dimension;
  7. import java.awt.Event;
  8. import java.awt.Frame;
  9. import java.awt.Graphics;
  10. import java.awt.LayoutManager;
  11. import java.awt.Panel;
  12. import java.awt.Point;
  13. import java.awt.Rectangle;
  14.  
  15. public class SplitterPanel extends Panel {
  16.    public static final int SPLIT_VER = 1;
  17.    public static final int SPLIT_HOR = 2;
  18.    public static final int SPLIT_VERTICAL = 1;
  19.    public static final int SPLIT_HORIZONTAL = 2;
  20.    public static final int SPLIT_BOTH = 3;
  21.    public static final int SPLIT_BOTH_V = 4;
  22.    public static final int SPLIT3_LEFT = 5;
  23.    public static final int SPLIT3_RIGHT = 6;
  24.    public static final int SPLIT3_TOP = 7;
  25.    public static final int SPLIT3_BOTTOM = 8;
  26.    private static final int SPLIT_NONE = 0;
  27.    public boolean use3dBdr;
  28.    private boolean enforceMinDim;
  29.    private boolean propResize;
  30.    public int moveSplitCursor;
  31.    private int splitType;
  32.    private boolean isOuter;
  33.    private Dimension curDim;
  34.    private Point curLoc;
  35.    private boolean dimChanged;
  36.    private boolean heightOnly;
  37.    private boolean widthOnly;
  38.    private boolean doMoveSplit;
  39.    private boolean cursorChanged;
  40.    private int moveFromX;
  41.    private int moveFromY;
  42.    private Component spComponent;
  43.    private SplitterPanel sub1;
  44.    private SplitterPanel sub2;
  45.    private SplitterPanel innerSP;
  46.    private SplitterPanel outerSP;
  47.    private static SplitterPanel cursorCh = null;
  48.    private Dimension minDim;
  49.    private Dimension prefDim;
  50.    private Color gapColor;
  51.    private int iGapWidth;
  52.    private int iGapHeight;
  53.    private int oGapWidth;
  54.    private int oGapHeight;
  55.    private int iBdrSize;
  56.    private int oBdrSize;
  57.    private boolean bOsFlag;
  58.  
  59.    public SplitterPanel() {
  60.       this(true);
  61.    }
  62.  
  63.    public SplitterPanel(int var1, int var2) {
  64.       this(true);
  65.       if (this != null) {
  66.          ((Component)this).resize(var1, var2);
  67.       }
  68.    }
  69.  
  70.    public SplitterPanel(int var1, int var2, int var3) {
  71.       this(var3);
  72.       if (this != null) {
  73.          ((Component)this).resize(var1, var2);
  74.       }
  75.    }
  76.  
  77.    public SplitterPanel(int var1) {
  78.       this(var1, (Component)null, (Component)null, (Component)null, (Component)null);
  79.    }
  80.  
  81.    public SplitterPanel(int var1, Component var2, Component var3, Component var4, Component var5) {
  82.       this(true);
  83.       if (this != null) {
  84.          switch (var1) {
  85.             case 0:
  86.                if (var2 != null) {
  87.                   ((Container)this).add(var2);
  88.                   return;
  89.                }
  90.             default:
  91.                return;
  92.             case 1:
  93.                this.split(1, var2, var3);
  94.                return;
  95.             case 2:
  96.                this.split(2, var2, var4);
  97.                return;
  98.             case 3:
  99.                this.split(2);
  100.                this.getSubPanel(1).split(1, var2, var3);
  101.                this.getSubPanel(2).split(1, var4, var5);
  102.                return;
  103.             case 4:
  104.                this.split(1);
  105.                this.getSubPanel(1).split(2, var2, var4);
  106.                this.getSubPanel(2).split(2, var3, var5);
  107.                return;
  108.             case 5:
  109.                this.split(1, (Component)null, var3);
  110.                this.getSubPanel(1).split(2, var2, var4);
  111.                return;
  112.             case 6:
  113.                this.split(1, var2, (Component)null);
  114.                this.getSubPanel(2).split(2, var3, var5);
  115.                return;
  116.             case 7:
  117.                this.split(2, (Component)null, var4);
  118.                this.getSubPanel(1).split(1, var2, var3);
  119.                return;
  120.             case 8:
  121.                this.split(2, var2, (Component)null);
  122.                this.getSubPanel(2).split(1, var4, var5);
  123.          }
  124.       }
  125.    }
  126.  
  127.    private SplitterPanel(boolean var1) {
  128.       this.use3dBdr = true;
  129.       this.enforceMinDim = false;
  130.       this.propResize = true;
  131.       this.moveSplitCursor = 13;
  132.       this.doMoveSplit = false;
  133.       this.cursorChanged = false;
  134.       this.isOuter = var1;
  135.       this.dimChanged = true;
  136.       this.heightOnly = false;
  137.       this.widthOnly = false;
  138.       this.splitType = 0;
  139.       this.setLayout((LayoutManager)null);
  140.       this.minDim = new Dimension(0, 0);
  141.       this.curDim = new Dimension(0, 0);
  142.       this.curLoc = new Point(0, 0);
  143.       this.prefDim = new Dimension(0, 0);
  144.       this.gapColor = Color.lightGray;
  145.       this.iGapWidth = 3;
  146.       this.iGapHeight = 3;
  147.       this.iBdrSize = 2;
  148.       this.oGapWidth = 3;
  149.       this.oGapHeight = 3;
  150.       this.oBdrSize = 2;
  151.       if (var1) {
  152.          this.innerSP = new SplitterPanel(false);
  153.          super.add(this.innerSP, -1);
  154.          this.outerSP = this;
  155.          this.innerSP.outerSP = this;
  156.       }
  157.  
  158.    }
  159.  
  160.    public void setGapColor(Color var1) {
  161.       this.gapColor = new Color(var1.getRed(), var1.getGreen(), var1.getBlue());
  162.       this.propagateChanges();
  163.    }
  164.  
  165.    public Color getGapColor() {
  166.       return this.gapColor;
  167.    }
  168.  
  169.    private void adjustOGapBdr() {
  170.       if (this.oGapWidth < this.oBdrSize) {
  171.          this.oGapWidth = Math.max(0, this.oBdrSize);
  172.       }
  173.  
  174.       if (this.oGapHeight < this.oBdrSize) {
  175.          this.oGapHeight = Math.max(0, this.oBdrSize);
  176.       }
  177.  
  178.    }
  179.  
  180.    public void setGapSizes(int var1) {
  181.       this.iGapWidth = var1;
  182.       this.iGapHeight = var1;
  183.       this.oGapWidth = var1;
  184.       this.oGapHeight = var1;
  185.       this.adjustOGapBdr();
  186.       this.propagateChanges();
  187.       ((Component)this).invalidate();
  188.    }
  189.  
  190.    public void setGapSizes(int var1, int var2) {
  191.       this.iGapWidth = var1;
  192.       this.iGapHeight = var2;
  193.       this.oGapWidth = var1;
  194.       this.oGapHeight = var2;
  195.       this.adjustOGapBdr();
  196.       this.propagateChanges();
  197.       ((Component)this).invalidate();
  198.    }
  199.  
  200.    public void setGapSizes(int var1, int var2, int var3, int var4) {
  201.       this.iGapWidth = var1;
  202.       this.iGapHeight = var2;
  203.       this.oGapWidth = var3;
  204.       this.oGapHeight = var4;
  205.       this.adjustOGapBdr();
  206.       this.propagateChanges();
  207.       ((Component)this).invalidate();
  208.    }
  209.  
  210.    public void setBdrSizes(int var1, int var2) {
  211.       this.iBdrSize = var1;
  212.       this.oBdrSize = var2;
  213.       this.adjustOGapBdr();
  214.       this.propagateChanges();
  215.       ((Component)this).invalidate();
  216.    }
  217.  
  218.    public void setBdrSizes(int var1) {
  219.       this.iBdrSize = var1;
  220.       this.oBdrSize = var1;
  221.       this.adjustOGapBdr();
  222.       this.propagateChanges();
  223.       ((Component)this).invalidate();
  224.    }
  225.  
  226.    public Color gapColor() {
  227.       return this.gapColor;
  228.    }
  229.  
  230.    public void setEnforceMinDim(boolean var1) {
  231.       this.enforceMinDim = var1;
  232.       this.propagateChanges();
  233.    }
  234.  
  235.    public boolean getEnforceMinDim() {
  236.       return this.enforceMinDim;
  237.    }
  238.  
  239.    public void setPropResize(boolean var1) {
  240.       this.propResize = var1;
  241.       this.propagateChanges();
  242.    }
  243.  
  244.    public boolean getPropResize() {
  245.       return this.propResize;
  246.    }
  247.  
  248.    public int getSplitType() {
  249.       SplitterPanel var1 = this;
  250.       if (this.isOuter) {
  251.          var1 = this.innerSP;
  252.       }
  253.  
  254.       return var1.splitType;
  255.    }
  256.  
  257.    public SplitterPanel getSubPanel(int var1) {
  258.       SplitterPanel var2 = this;
  259.       if (this.isOuter) {
  260.          var2 = this.innerSP;
  261.       }
  262.  
  263.       if (var1 == 1) {
  264.          return var2.sub1;
  265.       } else {
  266.          return var1 == 2 ? var2.sub2 : null;
  267.       }
  268.    }
  269.  
  270.    public SplitterPanel getSubPanel(int var1, int var2) {
  271.       return this.getSplitType() == var2 ? this.getSubPanel(var1) : null;
  272.    }
  273.  
  274.    public SplitterPanel getSub2Panel(int var1, int var2, int var3, int var4) {
  275.       SplitterPanel var5 = this.getSubPanel(var1, var2);
  276.       return var5 != null ? var5.getSubPanel(var3, var4) : null;
  277.    }
  278.  
  279.    public SplitterPanel getTopPanel() {
  280.       return this.getSubPanel(1, 2);
  281.    }
  282.  
  283.    public SplitterPanel getBottomPanel() {
  284.       return this.getSubPanel(2, 2);
  285.    }
  286.  
  287.    public SplitterPanel getLeftPanel() {
  288.       return this.getSubPanel(1, 1);
  289.    }
  290.  
  291.    public SplitterPanel getRightPanel() {
  292.       return this.getSubPanel(2, 1);
  293.    }
  294.  
  295.    public SplitterPanel getTopLeftPanel() {
  296.       return this.getSplitType() == 2 ? this.getSub2Panel(1, 2, 1, 1) : this.getSub2Panel(1, 1, 1, 2);
  297.    }
  298.  
  299.    public SplitterPanel getTopRightPanel() {
  300.       return this.getSplitType() == 2 ? this.getSub2Panel(1, 2, 2, 1) : this.getSub2Panel(2, 1, 1, 2);
  301.    }
  302.  
  303.    public SplitterPanel getBottomLeftPanel() {
  304.       return this.getSplitType() == 2 ? this.getSub2Panel(2, 2, 1, 1) : this.getSub2Panel(1, 1, 2, 2);
  305.    }
  306.  
  307.    public SplitterPanel getBottomRightPanel() {
  308.       return this.getSplitType() == 2 ? this.getSub2Panel(2, 2, 2, 1) : this.getSub2Panel(2, 1, 2, 2);
  309.    }
  310.  
  311.    public boolean handleEvent(Event var1) {
  312.       if (var1.target == this && this.isOuter) {
  313.          return this.oGapThis(var1);
  314.       } else {
  315.          switch (var1.id) {
  316.             case 501:
  317.                if (var1.target == this && this.splitType == 2 && this.outerSP.cursorChanged) {
  318.                   this.doMoveSplit = true;
  319.                   this.moveFromX = var1.x;
  320.                   this.moveFromY = var1.y;
  321.                   return true;
  322.                } else if (var1.target == this && this.splitType == 1 && this.outerSP.cursorChanged) {
  323.                   this.doMoveSplit = true;
  324.                   this.moveFromX = var1.x;
  325.                   this.moveFromY = var1.y;
  326.                   return true;
  327.                } else if (this.outerSP.cursorChanged) {
  328.                   Point var2 = ((Component)this).location();
  329.                   ((Component)this).getParent().postEvent(new Event(cursorCh, var1.when, var1.id, var2.x + var1.x, var2.y + var1.y, var1.key, var1.modifiers, var1.arg));
  330.                   return true;
  331.                }
  332.             case 506:
  333.                if (this.doMoveSplit) {
  334.                   this.setCursor(this.moveSplitCursor);
  335.                   return true;
  336.                }
  337.             case 502:
  338.                if (this.doMoveSplit) {
  339.                   this.moveSplit(var1.x - this.moveFromX, var1.y - this.moveFromY);
  340.                   this.doMoveSplit = false;
  341.                   return true;
  342.                }
  343.             case 504:
  344.             case 505:
  345.             default:
  346.                return super.handleEvent(var1);
  347.             case 503:
  348.                if (var1.target == this && this.splitType == 2 && this.inGap1(var1.x, var1.y)) {
  349.                   this.setCursor(this.moveSplitCursor);
  350.                   return true;
  351.                } else if (var1.target == this && this.splitType == 1 && this.inGap1(var1.x, var1.y)) {
  352.                   this.setCursor(this.moveSplitCursor);
  353.                   return true;
  354.                } else {
  355.                   return true;
  356.                }
  357.          }
  358.       }
  359.    }
  360.  
  361.    public int iGapWidth() {
  362.       return this.iGapWidth;
  363.    }
  364.  
  365.    public int iGapHeight() {
  366.       return this.iGapHeight;
  367.    }
  368.  
  369.    public int oGapWidth() {
  370.       return this.oGapWidth;
  371.    }
  372.  
  373.    public int oGapHeight() {
  374.       return this.oGapHeight;
  375.    }
  376.  
  377.    public int iBdrSize() {
  378.       return this.iBdrSize;
  379.    }
  380.  
  381.    public int oBdrSize() {
  382.       return this.oBdrSize;
  383.    }
  384.  
  385.    private int optSize(int var1, int var2, int var3, int var4, int var5, int var6) {
  386.       int var9 = Math.max(var2, 0);
  387.       int var10 = Math.max(var3, 1);
  388.       int var11 = Math.max(var4, 1);
  389.       int var12 = Math.max(var5, var10);
  390.       int var13 = Math.max(var6, var11);
  391.       int var7 = var1 - (var12 + var13 + var9);
  392.       if (var7 >= 0) {
  393.          float var16 = (float)var12 / (float)(var12 + var13);
  394.          return var12 + (int)((float)var7 * var16);
  395.       } else {
  396.          var7 = var1 - (var10 + var11 + var9);
  397.          if (var7 >= 0) {
  398.             float var15 = (float)var12 / (float)(var12 + var13);
  399.             return var10 + (int)((float)var7 * var15);
  400.          } else if (var1 > var9) {
  401.             float var8 = (float)var10 / (float)(var10 + var11);
  402.             return var10 + (int)((float)var7 * var8);
  403.          } else {
  404.             return var1;
  405.          }
  406.       }
  407.    }
  408.  
  409.    public synchronized void layout() {
  410.       this.placeComponents();
  411.    }
  412.  
  413.    private void placeComponents() {
  414.       Rectangle var13 = new Rectangle(this.curLoc.x, this.curLoc.y, this.curDim.width, this.curDim.height);
  415.       if (this.isOuter) {
  416.          int var16 = this.oGapWidth + this.oBdrSize;
  417.          int var18 = this.oGapHeight + this.oBdrSize;
  418.          int var20 = var13.width - (2 * this.oGapWidth + this.oBdrSize + 1);
  419.          int var22 = var13.height - (2 * this.oGapHeight + this.oBdrSize + 1);
  420.          this.innerSP.reshape(var16, var18, var20, var22);
  421.       } else {
  422.          Dimension var1;
  423.          Dimension var3;
  424.          if (this.sub1 == null) {
  425.             var3 = new Dimension(1, 1);
  426.             var1 = new Dimension(1, 1);
  427.          } else {
  428.             var3 = this.sub1.minimumSize();
  429.             var1 = this.sub1.preferredSize();
  430.          }
  431.  
  432.          Dimension var2;
  433.          Dimension var4;
  434.          if (this.sub2 == null) {
  435.             var4 = new Dimension(1, 1);
  436.             var2 = new Dimension(1, 1);
  437.          } else {
  438.             var4 = this.sub2.minimumSize();
  439.             var2 = this.sub2.preferredSize();
  440.          }
  441.  
  442.          this.dimChanged = false;
  443.          byte var5;
  444.          byte var6;
  445.          int var7;
  446.          int var8;
  447.          int var9;
  448.          int var10;
  449.          int var11;
  450.          int var12;
  451.          switch (this.splitType) {
  452.             case 0:
  453.                if (this.spComponent != null) {
  454.                   var5 = this.iBdrSize;
  455.                   var6 = this.iBdrSize;
  456.                   var9 = var13.width - 2 * this.iBdrSize;
  457.                   var10 = var13.height - 2 * this.iBdrSize;
  458.                   if (var9 < 0) {
  459.                      var9 = 0;
  460.                   }
  461.  
  462.                   if (var10 < 0) {
  463.                      var10 = 0;
  464.                   }
  465.  
  466.                   if (this.propResize) {
  467.                      this.spComponent.reshape(var5, var6, var9, var10);
  468.                   } else {
  469.                      this.spComponent.move(var5, var6);
  470.                   }
  471.  
  472.                   this.spComponent.layout();
  473.                   this.spComponent.invalidate();
  474.                   this.spComponent.validate();
  475.  
  476.                   try {
  477.                      this.spComponent.repaint();
  478.                      return;
  479.                   } catch (Exception var14) {
  480.                      ((Component)this).repaint();
  481.                      return;
  482.                   }
  483.                }
  484.  
  485.                return;
  486.             case 1:
  487.                var5 = 0;
  488.                var6 = 0;
  489.                var9 = this.optSize(var13.width, this.iGapWidth, var3.width, var4.width, var1.width, var2.width);
  490.                var10 = var13.height;
  491.                var7 = var9 + this.iGapWidth;
  492.                var8 = 0;
  493.                var11 = var13.width - var7;
  494.                var12 = var13.height;
  495.                break;
  496.             case 2:
  497.                var5 = 0;
  498.                var6 = 0;
  499.                var9 = var13.width;
  500.                var10 = this.optSize(var13.height, this.iGapHeight, var3.height, var4.height, var1.height, var2.height);
  501.                var7 = 0;
  502.                var8 = var10 + this.iGapHeight;
  503.                var11 = var13.width;
  504.                var12 = var13.height - var8;
  505.                break;
  506.             default:
  507.                return;
  508.          }
  509.  
  510.          if (this.heightOnly) {
  511.             this.heightOnly = false;
  512.             this.sub1.reshapeHeight(var6, var10);
  513.             this.sub2.reshapeHeight(var8, var12);
  514.          } else if (this.widthOnly) {
  515.             this.widthOnly = false;
  516.             this.sub1.reshapeWidth(var5, var9);
  517.             this.sub2.reshapeWidth(var7, var11);
  518.          } else {
  519.             this.sub1.reshape(var5, var6, var9, var10);
  520.             this.sub2.reshape(var7, var8, var11, var12);
  521.          }
  522.  
  523.          this.sub1.invalidate();
  524.          this.sub1.validate();
  525.          this.sub1.repaint();
  526.          this.sub2.invalidate();
  527.          this.sub2.validate();
  528.          this.sub2.repaint();
  529.       }
  530.    }
  531.  
  532.    public void moveSplit(int var1, int var2) {
  533.       if (this.isOuter) {
  534.          this.innerSP.moveSplit(var1, var2);
  535.       } else {
  536.          Dimension var5 = this.sub1.minimumSize();
  537.          Dimension var6 = this.sub2.minimumSize();
  538.          Rectangle var3 = new Rectangle(this.sub1.curLoc.x, this.sub1.curLoc.y, this.sub1.curDim.width, this.sub1.curDim.height);
  539.          Rectangle var4 = new Rectangle(this.sub2.curLoc.x, this.sub2.curLoc.y, this.sub2.curDim.width, this.sub2.curDim.height);
  540.          int var7 = var3.x;
  541.          int var8 = var3.y;
  542.          if (this.splitType == 2) {
  543.             if (var2 == 0) {
  544.                return;
  545.             }
  546.  
  547.             int var10;
  548.             int var14;
  549.             if (var2 > 0) {
  550.                if (this.enforceMinDim) {
  551.                   var14 = Math.max(var4.height - var2, var6.height);
  552.                } else {
  553.                   var14 = Math.max(var4.height - var2, 2 * this.iBdrSize);
  554.                }
  555.  
  556.                var10 = var3.height + var4.height - var14;
  557.             } else {
  558.                if (this.enforceMinDim) {
  559.                   var10 = Math.max(var3.height + var2, var5.height);
  560.                } else {
  561.                   var10 = Math.max(var3.height + var2, 2 * this.iBdrSize);
  562.                }
  563.  
  564.                var14 = var4.height + var3.height - var10;
  565.             }
  566.  
  567.             int var9 = var3.width;
  568.             int var13 = var4.width;
  569.             int var11 = var4.x;
  570.             int var12 = var4.y - var3.height + var10;
  571.             this.sub1.reshapeHeight(var8, var10);
  572.             this.sub2.reshapeHeight(var12, var14);
  573.          }
  574.  
  575.          if (this.splitType == 1) {
  576.             if (var1 == 0) {
  577.                return;
  578.             }
  579.  
  580.             int var15;
  581.             int var19;
  582.             if (var1 > 0) {
  583.                if (this.enforceMinDim) {
  584.                   var19 = Math.max(var4.width - var1, var6.width);
  585.                } else {
  586.                   var19 = Math.max(var4.width - var1, 2 * this.iBdrSize);
  587.                }
  588.  
  589.                var15 = var3.width + var4.width - var19;
  590.             } else {
  591.                if (this.enforceMinDim) {
  592.                   var15 = Math.max(var3.width + var1, var5.width);
  593.                } else {
  594.                   var15 = Math.max(var3.width + var1, this.iBdrSize);
  595.                }
  596.  
  597.                var19 = var4.width + var3.width - var15;
  598.             }
  599.  
  600.             int var16 = var3.height;
  601.             int var20 = var4.height;
  602.             int var18 = var4.y;
  603.             int var17 = var4.x - var3.width + var15;
  604.             this.sub1.reshapeWidth(var7, var15);
  605.             this.sub2.reshapeWidth(var17, var19);
  606.          }
  607.  
  608.          this.sub1.invalidate();
  609.          this.sub1.validate();
  610.          this.sub1.repaint();
  611.          this.sub2.invalidate();
  612.          this.sub2.validate();
  613.          this.sub2.repaint();
  614.       }
  615.    }
  616.  
  617.    public void update(Graphics var1) {
  618.       this.paint(var1);
  619.    }
  620.  
  621.    private void draw3DBdr(Graphics var1, int var2, int var3, int var4, int var5, int var6, Color var7, boolean var8) {
  622.       if (var6 >= 0) {
  623.          var1.setColor(this.use3dBdr ? var7 : var7.darker());
  624.  
  625.          for(int var9 = 0; var9 < var6; ++var9) {
  626.             if (this.use3dBdr) {
  627.                var1.draw3DRect(var2 + var9, var3 + var9, var4 - 2 * var9, var5 - 2 * var9, var8);
  628.             } else {
  629.                var1.drawRect(var2 + var9, var3 + var9, var4 - 2 * var9, var5 - 2 * var9);
  630.             }
  631.          }
  632.  
  633.       }
  634.    }
  635.  
  636.    public void paint(Graphics var1) {
  637.       if (this.dimChanged) {
  638.          this.placeComponents();
  639.       }
  640.  
  641.       Dimension var3 = ((Component)this).size();
  642.       Color var2 = ((Component)this).getBackground();
  643.       var1.setColor(var2);
  644.       if (this.isOuter) {
  645.          var1.setColor(this.gapColor);
  646.          var1.fillRect(0, 0, var3.width, var3.height);
  647.          this.draw3DBdr(var1, 0, 0, var3.width - 1, var3.height - 1, this.oBdrSize, this.gapColor, true);
  648.       } else if (this.splitType == 0) {
  649.          var1.setColor(var2);
  650.          var1.fillRect(0, 0, var3.width, var3.height);
  651.          this.draw3DBdr(var1, 0, 0, var3.width - 1, var3.height - 1, this.iBdrSize, this.gapColor, false);
  652.       } else {
  653.          var1.setColor(this.gapColor);
  654.          var1.fillRect(0, 0, var3.width, var3.height);
  655.       }
  656.  
  657.       super.paint(var1);
  658.    }
  659.  
  660.    public Component getComponent() {
  661.       return this.isOuter ? this.innerSP.getComponent() : this.spComponent;
  662.    }
  663.  
  664.    public Component[] getComponents() {
  665.       return null;
  666.    }
  667.  
  668.    private void propagateChanges() {
  669.       if (this.innerSP != null) {
  670.          this.propagateChangesSP(this.innerSP);
  671.          this.innerSP.propagateChanges();
  672.       }
  673.  
  674.       if (this.sub1 != null) {
  675.          this.propagateChangesSP(this.sub1);
  676.          this.sub1.propagateChanges();
  677.       }
  678.  
  679.       if (this.sub2 != null) {
  680.          this.propagateChangesSP(this.sub2);
  681.          this.sub2.propagateChanges();
  682.       }
  683.  
  684.    }
  685.  
  686.    private void propagateChangesSP(SplitterPanel var1) {
  687.       if (var1.oGapWidth != this.oGapWidth || var1.iGapWidth != this.iGapWidth || var1.oGapHeight != this.oGapWidth || var1.iGapHeight != this.iGapHeight || var1.iBdrSize != this.iBdrSize || var1.oBdrSize != this.oBdrSize || var1.use3dBdr != this.use3dBdr) {
  688.          this.dimChanged = true;
  689.          var1.dimChanged = true;
  690.       }
  691.  
  692.       var1.oGapWidth = this.oGapWidth;
  693.       var1.iGapWidth = this.iGapWidth;
  694.       var1.oGapHeight = this.oGapWidth;
  695.       var1.iGapHeight = this.iGapHeight;
  696.       var1.iBdrSize = this.iBdrSize;
  697.       var1.oBdrSize = this.oBdrSize;
  698.       var1.gapColor = this.gapColor;
  699.       var1.enforceMinDim = this.enforceMinDim;
  700.       var1.moveSplitCursor = this.moveSplitCursor;
  701.       var1.propResize = this.propResize;
  702.       var1.use3dBdr = this.use3dBdr;
  703.    }
  704.  
  705.    private Dimension maxDimOf(Dimension var1, Dimension var2) {
  706.       return new Dimension(Math.max(var1.width, var2.width), Math.max(var1.height, var2.height));
  707.    }
  708.  
  709.    public Dimension preferredSize() {
  710.       Dimension var1;
  711.       if (this.isOuter) {
  712.          var1 = new Dimension(this.innerSP.preferredSize());
  713.          var1.width += 2 * (this.oGapWidth + this.oBdrSize);
  714.          var1.height += 2 * (this.oGapHeight + this.oBdrSize);
  715.       } else if (this.splitType == 0) {
  716.          if (this.spComponent == null) {
  717.             var1 = new Dimension(0, 0);
  718.          } else {
  719.             var1 = new Dimension(this.spComponent.preferredSize());
  720.          }
  721.  
  722.          var1.width += 2 * this.iBdrSize;
  723.          var1.height += 2 * this.iBdrSize;
  724.       } else {
  725.          Dimension var2 = this.sub1.preferredSize();
  726.          Dimension var3 = this.sub2.preferredSize();
  727.          if (this.splitType == 2) {
  728.             var1 = new Dimension(var2.width, var2.height + var3.height);
  729.             var1.height += this.iGapHeight;
  730.          } else {
  731.             var1 = new Dimension(var2.width + var2.width, var2.height);
  732.             var1.width += this.iGapWidth;
  733.          }
  734.       }
  735.  
  736.       return this.maxDimOf(this.prefDim, var1);
  737.    }
  738.  
  739.    public Dimension minimumSize() {
  740.       Dimension var1;
  741.       if (this.isOuter) {
  742.          var1 = new Dimension(this.innerSP.minimumSize());
  743.          var1.width += 2 * (this.oGapWidth + this.oBdrSize);
  744.          var1.height += 2 * (this.oGapHeight + this.oBdrSize);
  745.       } else if (this.splitType == 0) {
  746.          if (this.spComponent == null) {
  747.             var1 = new Dimension(0, 0);
  748.          } else {
  749.             var1 = new Dimension(this.spComponent.minimumSize());
  750.          }
  751.  
  752.          var1.width += 2 * this.iBdrSize;
  753.          var1.height += 2 * this.iBdrSize;
  754.       } else {
  755.          Dimension var2 = this.sub1.minimumSize();
  756.          Dimension var3 = this.sub2.minimumSize();
  757.          if (this.splitType == 2) {
  758.             var1 = new Dimension(var2.width, var2.height + var3.height);
  759.             var1.height += this.iGapHeight;
  760.          } else {
  761.             var1 = new Dimension(var2.width + var2.width, var2.height);
  762.             var1.width += this.iGapWidth;
  763.          }
  764.       }
  765.  
  766.       return this.maxDimOf(this.minDim, var1);
  767.    }
  768.  
  769.    public void setPreferredSize(Dimension var1) {
  770.       this.prefDim.width = var1.width;
  771.       this.prefDim.height = var1.height;
  772.       this.prefDim = this.maxDimOf(var1, this.prefDim);
  773.       this.dimChanged = true;
  774.    }
  775.  
  776.    public void setMinimumSize(Dimension var1) {
  777.       this.minDim.width = var1.width;
  778.       this.minDim.height = var1.height;
  779.       this.prefDim = this.maxDimOf(var1, this.prefDim);
  780.       this.dimChanged = true;
  781.    }
  782.  
  783.    public synchronized void reshape(int var1, int var2, int var3, int var4) {
  784.       super.reshape(var1, var2, var3, var4);
  785.       if (this.curDim.width != var3 || this.curDim.height != var4 || this.curLoc.x != var1 || this.curLoc.y != var2) {
  786.          this.dimChanged = true;
  787.          this.curDim.width = var3;
  788.          this.curDim.height = var4;
  789.          this.curLoc.x = var1;
  790.          this.curLoc.y = var2;
  791.       }
  792.  
  793.    }
  794.  
  795.    public synchronized void reshapeWidth(int var1, int var2) {
  796.       Rectangle var3 = new Rectangle(this.curLoc.x, this.curLoc.y, this.curDim.width, this.curDim.height);
  797.       if (this.curDim.width != var2) {
  798.          this.dimChanged = true;
  799.          this.widthOnly = true;
  800.          this.curDim.width = var2;
  801.       }
  802.  
  803.       this.reshape(var1, var3.y, var2, var3.height);
  804.    }
  805.  
  806.    public synchronized void reshapeHeight(int var1, int var2) {
  807.       Rectangle var3 = new Rectangle(this.curLoc.x, this.curLoc.y, this.curDim.width, this.curDim.height);
  808.       if (this.curDim.height != var2) {
  809.          this.dimChanged = true;
  810.          this.heightOnly = true;
  811.          this.curDim.height = var2;
  812.       }
  813.  
  814.       this.reshape(var3.x, var1, var3.width, var2);
  815.    }
  816.  
  817.    public synchronized Component add(Component var1, int var2) {
  818.       if (var1 == null) {
  819.          return null;
  820.       } else if (this.isOuter) {
  821.          return this.innerSP.add(var1, var2);
  822.       } else {
  823.          if (this.spComponent != null) {
  824.             super.remove(this.spComponent);
  825.          }
  826.  
  827.          this.spComponent = super.add(var1, -1);
  828.          this.dimChanged = true;
  829.          return this.spComponent;
  830.       }
  831.    }
  832.  
  833.    public synchronized void remove(Component var1) {
  834.       if (this.isOuter) {
  835.          this.innerSP.remove(var1);
  836.       } else if (var1 == this.spComponent) {
  837.          this.spComponent = null;
  838.          super.remove(var1);
  839.       } else {
  840.          if (this.sub1 != null) {
  841.             this.sub1.remove(var1);
  842.          }
  843.  
  844.          if (this.sub2 != null) {
  845.             this.sub2.remove(var1);
  846.          }
  847.  
  848.       }
  849.    }
  850.  
  851.    public synchronized void removeAll() {
  852.       if (this.isOuter) {
  853.          this.innerSP.removeAll();
  854.       } else {
  855.          super.removeAll();
  856.          if (this.sub1 != null) {
  857.             super.add(this.sub1, -1);
  858.             this.sub1.removeAll();
  859.          }
  860.  
  861.          if (this.sub2 != null) {
  862.             super.add(this.sub2, -1);
  863.             this.sub1.removeAll();
  864.          }
  865.       }
  866.  
  867.       this.spComponent = null;
  868.    }
  869.  
  870.    public SplitterPanel split(int var1) {
  871.       return this.split(var1, (Component)null, (Component)null);
  872.    }
  873.  
  874.    public synchronized SplitterPanel split(int var1, Component var2, Component var3) {
  875.       if (this.isOuter) {
  876.          return this.innerSP.split(var1, var2, var3);
  877.       } else if (this.splitType != 0) {
  878.          return null;
  879.       } else if (var1 != 1 && var1 != 2) {
  880.          return null;
  881.       } else {
  882.          this.sub1 = new SplitterPanel(false);
  883.          if (this.sub1 == null) {
  884.             return null;
  885.          } else {
  886.             this.sub2 = new SplitterPanel(false);
  887.             if (this.sub2 == null) {
  888.                super.remove(this.sub1);
  889.                return null;
  890.             } else {
  891.                this.splitType = var1;
  892.                this.sub1.outerSP = this.outerSP;
  893.                this.sub2.outerSP = this.outerSP;
  894.                super.add(this.sub1, -1);
  895.                super.add(this.sub2, -1);
  896.                if (var2 != null) {
  897.                   this.sub1.add(var2);
  898.                }
  899.  
  900.                if (var3 != null) {
  901.                   this.sub2.add(var3);
  902.                }
  903.  
  904.                return this.sub1;
  905.             }
  906.          }
  907.       }
  908.    }
  909.  
  910.    public void setLayout(LayoutManager var1) {
  911.    }
  912.  
  913.    private Frame findFrame() {
  914.       Object var2 = this;
  915.       Class var3 = this.getClass();
  916.  
  917.       Class var1;
  918.       try {
  919.          var1 = Class.forName("java.awt.Frame");
  920.       } catch (ClassNotFoundException var4) {
  921.          return null;
  922.       }
  923.  
  924.       while(var2 != null) {
  925.          var2 = ((Component)var2).getParent();
  926.  
  927.          for(var3 = var2.getClass(); var3 != var1 && var3 != null; var3 = var3.getSuperclass()) {
  928.          }
  929.  
  930.          if (var3 == var1) {
  931.             return (Frame)var2;
  932.          }
  933.       }
  934.  
  935.       return null;
  936.    }
  937.  
  938.    private void resetCursor() {
  939.       if (this.outerSP.cursorChanged) {
  940.          Frame var1 = this.findFrame();
  941.          if (var1 != null) {
  942.             try {
  943.                var1.setCursor(0);
  944.                this.outerSP.cursorChanged = false;
  945.                cursorCh = null;
  946.             } catch (IllegalArgumentException var2) {
  947.             }
  948.          }
  949.       }
  950.    }
  951.  
  952.    private int setCursor(int var1) {
  953.       if (this.outerSP.cursorChanged) {
  954.          return var1;
  955.       } else if (!this.isOuter) {
  956.          return this.outerSP.setCursor(var1);
  957.       } else {
  958.          Frame var2 = this.findFrame();
  959.          if (var2 == null) {
  960.             return Integer.MIN_VALUE;
  961.          } else {
  962.             try {
  963.                var2.setCursor(var1);
  964.                this.cursorChanged = true;
  965.                return var1;
  966.             } catch (IllegalArgumentException var3) {
  967.                return Integer.MIN_VALUE;
  968.             }
  969.          }
  970.       }
  971.    }
  972.  
  973.    private boolean inComponent(Component var1, int var2, int var3) {
  974.       Rectangle var4 = var1.bounds();
  975.       var4.grow(-this.iBdrSize - 1, -this.iBdrSize - 1);
  976.       return var2 - var4.x >= 0 && var2 - var4.x <= var4.width && var3 - var4.y >= 0 && var3 - var4.y <= var4.height;
  977.    }
  978.  
  979.    private boolean inGap(Event var1) {
  980.       return this.inGap(var1.x, var1.y);
  981.    }
  982.  
  983.    private boolean inGap(int var1, int var2) {
  984.       if (this.inGap1(var1, var2)) {
  985.          return true;
  986.       } else if (this.isOuter) {
  987.          return this.innerSP.inGap(var1 - this.innerSP.curLoc.x, var2 - this.innerSP.curLoc.y);
  988.       } else if (this.splitType != 2 && this.splitType != 1) {
  989.          return false;
  990.       } else {
  991.          return this.sub1.inGap(var1 - this.sub1.curLoc.x, var2 - this.sub1.curLoc.y) || this.sub2.inGap(var1 - this.sub2.curLoc.x, var2 - this.sub2.curLoc.y);
  992.       }
  993.    }
  994.  
  995.    private boolean inGap1(int var1, int var2) {
  996.       if (!((Component)this).inside(var1, var2)) {
  997.          return false;
  998.       } else if (this.isOuter) {
  999.          return false;
  1000.       } else if (this.inOutBoarder(var1, var2)) {
  1001.          return false;
  1002.       } else if (this.splitType != 2 && this.splitType != 1) {
  1003.          return false;
  1004.       } else if (!this.inComponent(this.sub1, var1, var2) && !this.inComponent(this.sub2, var1, var2)) {
  1005.          if (this.inComponent(this, var1, var2)) {
  1006.             cursorCh = this;
  1007.          }
  1008.  
  1009.          return true;
  1010.       } else {
  1011.          return false;
  1012.       }
  1013.    }
  1014.  
  1015.    private boolean inOutBoarder(int var1, int var2) {
  1016.       Object var3 = this;
  1017.       Rectangle var4 = ((Component)this).bounds();
  1018.       int var5 = var4.x;
  1019.  
  1020.       int var6;
  1021.       for(var6 = var4.y; var3 != this.outerSP; var6 += var4.y) {
  1022.          var3 = ((Component)var3).getParent();
  1023.          var4 = ((Component)var3).bounds();
  1024.          var5 += var4.x;
  1025.       }
  1026.  
  1027.       var4.grow(-(this.outerSP.iBdrSize + this.outerSP.oBdrSize + this.outerSP.oGapWidth / 2 + 4), -(this.outerSP.iBdrSize + this.outerSP.oBdrSize + this.outerSP.oGapHeight / 2 + 4));
  1028.       var4.move(var4.x + this.outerSP.oGapWidth / 2, var4.y + this.outerSP.oGapHeight / 2);
  1029.       return !var4.inside(var5 + var1, var6 + var2);
  1030.    }
  1031.  
  1032.    public boolean oGapThis(Event var1) {
  1033.       if (!this.doMoveSplit && !this.inGap(var1)) {
  1034.          this.resetCursor();
  1035.       }
  1036.  
  1037.       return true;
  1038.    }
  1039.  
  1040.    public String toString() {
  1041.       String var1 = "Bad Panel ";
  1042.       if (this.isOuter) {
  1043.          var1 = "Outer ";
  1044.       } else {
  1045.          if (this.splitType == 0) {
  1046.             var1 = "Unsplit ";
  1047.          }
  1048.  
  1049.          if (this.splitType == 1) {
  1050.             var1 = "Vertically split ";
  1051.          }
  1052.  
  1053.          if (this.splitType == 2) {
  1054.             var1 = "Horizontally split ";
  1055.          }
  1056.       }
  1057.  
  1058.       Container var2 = ((Component)this).getParent();
  1059.       String var3;
  1060.       if (var2 == null) {
  1061.          var3 = " with no parent (not added)";
  1062.       } else {
  1063.          var3 = " with parent @" + var2.hashCode();
  1064.       }
  1065.  
  1066.       return var1 + super.toString() + ": @" + this.hashCode() + var3;
  1067.    }
  1068. }
  1069.